package com.xuxin.nantai.presenter;

import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.bean.GroupBean;
import com.xuxin.nantai.bean.InspectorBean;
import com.xuxin.nantai.bean.SelectFlowingBean;
import com.xuxin.nantai.contract.SelectUpdateContract;
import com.xuxin.nantai.model.SelectUpdateModel;

/**
 * Created by xu_xin
 * Created on 2020.06.12 0012
 */
public class SelectUpdatePresenter implements SelectUpdateContract.Presenter {
    private SelectUpdateModel model;
    private SelectUpdateContract.View view;

    public SelectUpdatePresenter(SelectUpdateContract.View view) {
        model = new SelectUpdateModel();
        this.view = view;
    }

    @Override
    public void getInspector(String loginName, String TeamType) {
        if (null != model) {
            model.getInspector(this, loginName,TeamType);
        }
    }

    @Override
    public void getSelectFlowing(String FlowingCode,String inspectorCode,String loginName) {
        if (null != model) {
            model.getSelectFlowing(this, FlowingCode,inspectorCode,loginName);
        }
    }

    @Override
    public void getGroups() {
        if (null != model) {
            model.getGroups(this);
        }
    }

    @Override
    public void save(String LoginName,
                     String UserName,
                     String Guid,
                     String ID,
                     String team,
                     int reCheck,
                     String flowingCode,
                     String cInvName,
                     String cInvCode,
                     String packNum,
                     String comNum,
                     String percent,
                     String checkNum,
                     String area,
                     String groupName,
                     String groupCode,
                     String inspectorName,
                     String inspectorCode,
                     String inspectorTime,
                     String result,
                     String mark) {
        if (null != model) {
            model.save(this,
                    LoginName,
                    UserName,
                    Guid,
                    ID,
                    team,
                    reCheck,
                    flowingCode,
                    cInvName,
                    cInvCode,
                    packNum,
                    comNum,
                    percent,
                    checkNum,
                    area,
                    groupName,
                    groupCode,
                    inspectorName,
                    inspectorCode,
                    inspectorTime,
                    result,
                    mark);
        }
    }

    @Override
    public void onSuccess(InspectorBean inspectorBean) {
        if (null != view) {
            view.onSuccess(inspectorBean);
        }
    }

    @Override
    public void onSuccess(SelectFlowingBean selectFlowingBean) {
        if (null != view) {
            view.onSuccess(selectFlowingBean);
        }
    }

    @Override
    public void onSuccess(GroupBean groupBean) {
        if (null != view) {
            view.onSuccess(groupBean);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}